package guowei.gulielasticsearch.controller;

import guowei.common.to.es.EsModel;
import guowei.common.utils.R;
import guowei.gulielasticsearch.service.EsProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/es/product")
public class EsProduct {

    @Autowired
    private EsProductService esProductService;

    @PostMapping("/save")
    public R saveProducts(@RequestBody List<EsModel> esModels){
        esProductService.saveEsProducts(esModels);
        return R.ok();
    }
}
